package com.liuya.safe.policy.service;

import com.liuya.base.BaseService;
import com.liuya.common.exception.EntityExistException;
import com.liuya.safe.model.SafeUser;
import com.liuya.entitle.QueryTestResult;
import com.liuya.safe.model.SafeQuery;

import java.util.Collection;
import java.util.Map;

/**
 * 查询策略管理
 * @author liuya
 * @date 20160912
 */
public interface QueryManagerService extends BaseService<SafeQuery> {

    public Collection getLikelyQueries(String name) ;

    public SafeQuery getQuery(String name, boolean isLeaf) ;

    public Collection checkSameNameQueries(String srcFile) ;

    /**
     * 获取所有查询
     * @return
     */
    public Collection getAllQueries() ;

    public SafeQuery addQuery(String pid, String name, String description, boolean isLeaf) throws EntityExistException ;

    public void deleteQuery(String id) ;

    public SafeQuery getQuery(String id) ;

    public void updateQuery(String id, String name, String description) throws EntityExistException ;

    /**
     * 更新查询策略
     * @param id
     * @param content
     * @throws EntityExistException
     */
    public void updateQuery(String id, com.liuya.db.sql.xml.Query content) throws EntityExistException ;

    public SafeQuery getQueryTree() ;

    public void moveQuery(String id, String newPid) ;

    public SafeQuery copyQuery(String sourceId, String newName, String newDescription) throws EntityExistException ;

    public void addReservedQuery(String userTypeName) ;

    public QueryTestResult testQuery(com.liuya.db.sql.Query query, SafeUser user, Map context, int start, int limit) ;

    public SafeQuery cloneQuery(SafeQuery query);
}
